 <{extends file="<{$tempdir}>/public/wxsite.html"}>  
<{block name=extendcss}> 
	<link rel="stylesheet"  href="<{$siteurl}>/templates/<{$tempdir}>/public/wxsite/css/public.css">   
 <link rel="stylesheet"  href="<{$siteurl}>/templates/<{$tempdir}>/public/wxsite/css/shoplist.css">   

 <style>
 .clkitm { min-height: 80px;}
 #cuisien{padding-left:0px;padding-right:0px;margin-left:0px; margin-right:0px;}
 #cuisien li{padding-left:0px;padding-right:0px;margin-left:0px; margin-right:0px;}
 </style>
<{/block}>
  <{block name=extendjs}> 
 <script src="<{$siteurl}>/templates/<{$tempdir}>/public/wxsite/js/template.min.js"></script>     
 <script>
var can_show = true;
var page = 1;
var catid = <{$typeid|default:0}>;
var order = 0;
var qsjid = 0;
var typeid = <{$typeid|default:0}>;
var myaddress = '<{$myaddress}>';
var search_input = '<{$search_input}>';
var shopshowtype  = '<{$shopshowtype}>';
$(function(){ 
$('.toptitBox .toptitL').bind("click", function() {    
	    history.back();
   });
	shopdata();	
	 
	if( typeid != '' ){
		$('.kwselected span').html( $(".typeid_"+typeid).attr('catename') );
		
  
			 $(".typeid_"+typeid).addClass('xz').siblings().removeClass('xz');
		   $('#toolbar').find('.se').removeClass('se');
		   $('#toolbar').find('.sh').removeClass('sh');
		   $('#supplierlist').html('');
		
		   $('#toolbar').find('li').eq(0).html('<a>'+ $(".typeid_"+typeid).text()+'<b class=""></b></a>');
		   catid = $(".typeid_"+typeid).attr('id');//alert(this).
		   can_show = true; 
		   page = 1;
		   
		   $(".kouweidiv").hide();
		   
		 
	}
	

	 
 		$('#toolbar .sele>li').bind("click", function() {   
	    $('#toolbar .sele>b').removeClass('se');
     $(this).addClass('se').siblings().removeClass('se');
     $(this).find('b').addClass('se');
      $('#toolbar .sub').addClass('sh');
       var cc = $('#toolbar .sele').find('li').index(this); 
       $('#toolbar .lizd').eq(cc).show().siblings().hide();//('sh'); 
   
      });

 	$('#sorts li').bind("click",function(){
	  $(this).addClass('xz').siblings().removeClass('xz');
	    $('#toolbar').find('.se').removeClass('se');
      $('#toolbar').find('.sh').removeClass('sh'); 
	    $('#toolbar').find('li').eq(2).html('<a>'+$(this).text()+'<b class=""></b></a>');
	    order = $(this).attr('value');
	   $('#supplierlist').html('');
      page = 1;
   	  can_show = true; 
	    shopdata(); 
  });
  $('.lizd li').bind("hover",function(){
	   $(this).addClass('tapclass').siblings().removeClass('tapclass');
  });
  $('#cuisien li').bind('click',function(){

		$('.kwselected span').html( $(this).attr('catename') );
		
  
	   $(this).addClass('xz').siblings().removeClass('xz');
	   $('#toolbar').find('.se').removeClass('se');
	   $('#toolbar').find('.sh').removeClass('sh');
	   $('#supplierlist').html('');
	
	   $('#toolbar').find('li').eq(0).html('<a>'+$(this).text()+'<b class=""></b></a>');
	   catid = $(this).attr('id');//alert(this).
	   can_show = true; 
	   page = 1;
	   
	   $(".kouweidiv").hide();
	   myScroll.refresh();
	   shopdata(); 
   });
   $('#cuisienpx li').bind('click',function(){

		$('.kwselectedpx span').html( $(this).attr('catename') );
		
  
	   $(this).addClass('xz').siblings().removeClass('xz');
	   $('#toolbar').find('.se').removeClass('se');
	   $('#toolbar').find('.sh').removeClass('sh');
	   $('#supplierlist').html('');
	
	   $('#toolbar').find('li').eq(0).html('<a>'+$(this).text()+'<b class=""></b></a>');
	   order = $(this).attr('orderid');//alert(this).
	   can_show = true; 
	   page = 1;
	   
	   $(".kouweidivpx").hide();
	   myScroll.refresh();
	   shopdata(); 
   });
   $('#cuisienqsj li').bind('click',function(){

		$('.kwselectedqsj span').html( $(this).attr('catename') );
		
  
	   $(this).addClass('xz').siblings().removeClass('xz');
	   $('#toolbar').find('.se').removeClass('se');
	   $('#toolbar').find('.sh').removeClass('sh');
	   $('#supplierlist').html('');
	
	   $('#toolbar').find('li').eq(0).html('<a>'+$(this).text()+'<b class=""></b></a>');
	   qsjid = $(this).attr('qsjid');//alert(this).
	   can_show = true; 
	   page = 1;
	   
	   $(".kouweidivqsj").hide();
	   myScroll.refresh();
	   shopdata(); 
   }); 
});
  function shopdata(){  
			  
			var tempurl = siteurl+'/index.php?ctrl=wxsite&action=shoplistdata&areaid=<{$areaid}>&search_input='+search_input+'&order='+order+'&catid='+catid+'&qsjid='+qsjid+'&random=@random@&page=@page@';
   	 	     tempurl = tempurl.replace('@random@', 1+Math.round(Math.random()*1000)).replace('@page@',page);
	         $.getScript(tempurl); 
  
  }
 function showmoreshop(datas){
  
	var spdatas = eval(datas); 
    if(spdatas.length > 0){
		$("#pullUp").show();
		
		for(i=0;i<spdatas.length;i++){
			 if(spdatas.length < 10){
				$('.pullUpLabel').text('更多商家,敬请期待中...'); 
			 }
		 	var tempdata = 'red';
				var tempdata2 = '营业中';
					if(spdatas[i].opentype != 2){
					tempdata = '#ccc';
					tempdata2 = '已打烊';
				} 
				if(spdatas[i].opentype ==3){
					tempdata = 'green';
					tempdata2 = '可预订';
				} 
				var backdata = '';
				
<{if $mobilemodule  == 2 }>
				 backdata =' <ul class="nearbyre"  data-supplierid="'+spdatas[i].id+'"  > ';
				  if(spdatas[i].shoptype == 1  ){   
					backdata +=' <a href="'+siteurl+'/index.php?ctrl=wxsite&action=shopshow&typelx=mk&id='+spdatas[i].id+'">';
				  }else{
					<{if $shopshowtype == 'dingtai'}>
				 		backdata += '<a href="'+siteurl+'/index.php?ctrl=wxsite&action=shopshow&typelx=yd&id='+spdatas[i].id+'">';
					<{else}>
				 		backdata += '<a href="'+siteurl+'/index.php?ctrl=wxsite&action=shopshow&typelx=wm&id='+spdatas[i].id+'">';
					<{/if}>
				  }
				 backdata +='  	<li class="nearbyreLimg"><img  class="scrollLoading"  src="'+spdatas[i].shoplogo+'"></li> ';
				 backdata +='  	<li class="nearbyreRco"> ';
				 backdata +='  	 <ul class="nearbyrecommend"> ';
				 backdata +='  	  <li><h3>'+spdatas[i].shopname+'</h3></li> ';
				 if(spdatas[i].opentype ==3){
					backdata +='  		<li class="nerestate" style="margin-top: 8px;"><i class="nerejs"></i></li> ';
				 }
				  if(spdatas[i].opentype != 2 && spdatas[i].opentype != 3   ){
					backdata +='  		<li class="nerestate" style="margin-top: 8px;"><i class="nerexx"></i></li> ';
				 }
				 backdata +='  	  <li> ';
				 backdata +='  	   <ul class="neresavo"> ';
				 backdata +='  		<li> ';
				 for(j=1;j<=spdatas[i].point;j++){
					backdata += '<i class="fa fa-star"></i>';
				}
				for(q=1;q<=5-spdatas[i].point;q++){
					backdata += '<i class="fa fa-star" style="color:#C7C7C7;"></i>';
				}
				 
				 backdata +='  	 </li> ';
				 backdata +='  		<li>月售'+spdatas[i].ordercount+'单</li> ';
				 <{if $shopshowtype != 'dingtai' }>
				 if(spdatas[i].sendtype ==  0){
				 backdata +='  		<li style=" float:right;"><i class="nermyf"></i></li> ';
				 }
				 <{/if}>
				 backdata +='  	   </ul> ';
				 backdata +='  	  </li> ';
				 backdata +='  	  <li> ';
				 <{if $shopshowtype != 'dingtai' }>
					 backdata +='  	   <ul class="nereprice"> ';
					 backdata +='  		<li><span>起送价<b>￥'+spdatas[i].limitcost+'</b></span>|</li> ';
					 backdata +='  		<li><span>配送费<b>￥'+spdatas[i].pscost+'</b></span>';
 					 if(spdatas[i].attrdet.input != ''){ backdata +='|';}
					  backdata +='  		</li> ';
					 if(spdatas[i].attrdet.input != ''){
						backdata +='  		<li><span>'+spdatas[i].attrdet.input+'送达</span></li> ';
					 }
					 backdata +='  	   </ul> ';
				<{else}>
					 backdata +='  	   <ul class="nereprice"> ';
					 backdata +='  		<li><span>地址 : '+spdatas[i].address+'</span></li> '; 
					 backdata +='  		<li><span>营业时间 : '+spdatas[i].starttime+'</span></li> '; 
					 backdata +='  	   </ul> ';
				 <{/if}>
				 backdata +='  	  </li> ';
				 if(spdatas[i].cxlist.length > 0){
					 for(var c=0;c<spdatas[i].cxlist.length;c++){
				 backdata +='  	  <li class="neredisc"><i class="nereyh" style=" margin-top: 5px;background:url('+spdatas[i].cxlist[c].imgurl+') no-repeat left center ;background-size: 100%;"></i><span>'+spdatas[i].cxlist[c].name+'</span></li> ';
					 }
				}
				 backdata +='  	 </ul> ';
				 backdata +='  	</li> ';
				 backdata +='   </a>';
				 backdata +='  </ul>  ';
<{else}>
			
			backdata +='  	 <li> ';
		
				backdata +='  		<div class="homscrbusinimg"><img src="'+spdatas[i].shoplogo+'"></div> ';
				 
				backdata +='  		<div class="listbox"> ';
				
				
				if(spdatas[i].shoptype == 1  ){   
				
					backdata +=' <a href="'+siteurl+'/index.php?ctrl=wxsite&action=shopshow&typelx=mk&id='+spdatas[i].id+'">';
				  }else{
					<{if $shopshowtype == 'dingtai'}>
				 		backdata += '<a href="'+siteurl+'/index.php?ctrl=wxsite&action=shopshow&typelx=yd&id='+spdatas[i].id+'">';
					<{else}>
				 		backdata += '<a href="'+siteurl+'/index.php?ctrl=wxsite&action=shopshow&typelx=wm&id='+spdatas[i].id+'">';
					<{/if}>
				  }
				
				
				backdata +='  		<div class="homscrbusinR"> ';
				backdata +='  		 <div class="homscrbusint" style="height:21px;line-height:21px;"><span style="height:18px;line-height:18px;">'+spdatas[i].shopname+'</span>   '
				if(spdatas[i].opentype != 2  && spdatas[i].opentype != 3    ) {
					backdata += '<span   style="background:#c2c2c2;font-size:12px;font-weight:normal;height:15px;line-height:15px;border-radius:5px;padding:2px 4px;color:#fff;">休息中</span> ';
				}
				backdata +='  	</div> ';
				backdata +='  		 <div class="homscrbusinsale"> ';
				for(j=1;j<=spdatas[i].point;j++){
					backdata += '<i class="fa fa-star"></i>';
				}
				for(q=1;q<=5-spdatas[i].point;q++){
					backdata += '<i class="fa fa-star" style="color:#C7C7C7;"></i>';
				}
				 
				backdata +='  		<span>月售'+spdatas[i].ordercount+'单</span></div> ';
				backdata +='  		 <div class="homscrbusinpric" style="overflow:auto;"><span>起送价￥'+spdatas[i].limitcost+'</span><b>|</b><span>配送费￥'+spdatas[i].pscost+'</span> ';
				if(spdatas[i].attrdet.input != undefined && spdatas[i].attrdet.input != '' ){
					backdata +='  		<b>|</b><span>'+spdatas[i].attrdet.input+'</span>';
				}
				backdata +='  		</div> ';
				backdata +='  		 <div class="homscrbusinadd" >距'+spdatas[i].juli+' &nbsp;'+spdatas[i].address+'</div> ';
				backdata +='  		</div> ';
					backdata +='  	</a> ';
				
		 <{if $open_wxcx == 1}>		
						     //促销开始
            if(spdatas[i].cxlist.length >0){
                backdata +='<div class="hoPaNearBot cx_maxh"  style="padding:5px 0; position:relative;border-top:1px dotted #d6d6d6;">';
                backdata +=' <ul>';
                for(var c=0;c<spdatas[i].cxlist.length;c++){
                    backdata +=' <li style="padding:0px 0; overflow:hidden;border:none;">' ;
                    backdata += '<i class="icon_shou" style="background-image:url('+spdatas[i].cxlist[c].imgurl+');width:14px; height:14px; float:left; margin:6px 5px 0 0; background-size:100%;"></i>' ;
                    backdata += '<span style=" width:60%; white-space:nowrap;font-size:12px; text-overflow:ellipsis; float:left; overflow:hidden;">'+spdatas[i].cxlist[c].name+'</span>' ;
                    backdata += '</li>';
                }
                backdata +=' </ul>';
				if( spdatas[i].cxlist.length > 2 ){
                backdata +=' <span class="hoPaNearBotsp" id="hoPaNearBotsp" onclick="cx_maxh();" style="font-size:12px; color:#808080; position:absolute; top:5px; right:0px;">'+spdatas[i].cxlist.length+'个活动<i class="fa fa-caret-down" style="color:#666666; margin-left:5px;"></i></span>';
					}
			   backdata +='</div>';
            }
            //促销结束
			<{/if}>
				
				backdata +='  		</div> ';
			
				
				
		
				
				
				backdata +='  	</li> ';
				


<{/if}>			
	
	
			$('#supplierlist').append(backdata); 
			
		}
			  setTimeout(function () { 
		 
		 myScroll.refresh();
		// 数据加载完成后，调用界面更新方法 Remember to refresh when contents are loaded (ie: on ajax completion)
	}, 200);
				page = Number(page+1);  
       
               
	}else{
			setTimeout(function () { 
		 
		 myScroll.refresh();
		// 数据加载完成后，调用界面更新方法 Remember to refresh when contents are loaded (ie: on ajax completion)
	}, 200);
				can_show ==  false; 
      		      if(page == 1){ 
      		      	 error($('#supplierlist'),'很遗憾,附近商家正在覆盖中...'); 
					$("#pullUp").hide();
      		      }else{ 
      		        $('.pullUpLabel').text('更多商家,敬请期待中...'); 
      		      }
      		   
		
		}
		
		
	 
    	
 }
  
</script>
 <{if $open_wxcx == 1}>
	<style>
		.cx_maxh{max-height:40px;overflow:hidden;}
	.flipy {
		-moz-transform: scaleY(-1);
		-webkit-transform: scaleY(-1);
		-o-transform: scaleY(-1);
		transform: scaleY(-1);
		filter: FlipV();
	}
	</style>
	<script>
	function cx_maxh(){
		if($(".hoPaNearBot").hasClass("cx_maxh")){
			$(".hoPaNearBot").removeClass('cx_maxh');
			$(".fa-caret-down").addClass('flipy');
			myScroll.refresh();
		}else{
			$(".hoPaNearBot").addClass('cx_maxh');
			$(".fa-caret-down").removeClass('flipy');
			myScroll.refresh();
		}
	}
	</script>
	<{/if}>	
<{/block}>
<{block name=myScrolljs}>
 
<script>
		var myScroll, pullDownEl, pullDownOffset,pulldowncate,
	pullUpEl, pullUpOffset,
	generatedCount = 0;

function pullDownAction () {
	 
}

function pullUpAction () {
		setTimeout(function () { 
			shopdata(); 
			// 数据加载完成后，调用界面更新方法 Remember to refresh when contents are loaded (ie: on ajax completion)
		}, 300);	// <-- Simulate network congestion, remove setTimeout from production!
}

function loaded() {
	pullDownEl = document.getElementById('pullDown');
	pullDownOffset = pullDownEl.offsetHeight;
	pullUpEl = document.getElementById('pullUp');	
	pullUpOffset = pullUpEl.offsetHeight;
	
	myScroll = new iScroll('wrapper', {
		scrollbarClass: 'myScrollbar', /* 重要样式 */
		useTransition: false, /* 此属性不知用意，本人从true改为false */
		topOffset: pullDownOffset,
		onRefresh: function () {
			if (pullDownEl.className.match('loading')) {
				pullDownEl.className = '';
				pullDownEl.querySelector('.pullDownLabel').innerHTML = '下拉刷新...';
			} else if (pullUpEl.className.match('loading')) {
				pullUpEl.className = '';
				pullUpEl.querySelector('.pullUpLabel').innerHTML = '上拉加载更多...';
			}
		},
		onScrollMove: function () { 
			if (this.y > 1 && !pullDownEl.className.match('flip')) {
				
				pullDownEl.className = 'flip';
				pullDownEl.querySelector('.pullDownLabel').innerHTML = '松手开始更新...';
				this.minScrollY = 0;
			} else if (this.y < 1 && pullDownEl.className.match('flip')) {
				pullDownEl.className = '';
				pullDownEl.querySelector('.pullDownLabel').innerHTML = '下拉刷新...';
				this.minScrollY = -pullDownOffset;
			} else if (this.y < (this.maxScrollY - 50) && !pullUpEl.className.match('flip')) {
				pullUpEl.className = 'flip';
				pullUpEl.querySelector('.pullUpLabel').innerHTML = '松手开始更新...';
				this.maxScrollY = this.maxScrollY;
			} else if (this.y > (this.maxScrollY + 1) && pullUpEl.className.match('flip')) {
		
				pullUpEl.className = '';
				pullUpEl.querySelector('.pullUpLabel').innerHTML = '上拉加载更多...';
				this.maxScrollY = pullUpOffset;
			}
		},
		onScrollEnd: function () {
			if (pullUpEl.className.match('flip')) {
				if (this.y < (this.maxScrollY + 50)){
					 
					pullUpEl.className = 'loading';
					pullUpEl.querySelector('.pullUpLabel').innerHTML = '加载中...';				
				 	pullUpAction();	
				}
			}
		
			 
		}
	});
	pulldowncate = new iScroll('wrappercate', {
		hScrollbar:false, 
		vScrollbar:false,
		useTransition: true,
		topOffset: pullDownOffset
		
	});
	
	setTimeout(function () { document.getElementById('wrappercate').style.left = '0'; }, 200);
	setTimeout(function () { document.getElementById('wrapper').style.left = '0'; }, 200);
}

//初始化绑定iScroll控件 
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
document.addEventListener('DOMContentLoaded', loaded, false); 



</script>

<{/block}>
<{block name=sitetitle}><{$sitename}><{/block}>
<{block name=hearnav}>
<{if $wxType == 2 }>
<div class="toptitCon">
 <div class="toptitBox">
  <div class="toptitL"><a href="#"><i></i></a></div>
  <div class="toptitC"><h3><{if $shopshowtype == 'waimai' }>外卖<{/if}><{if $shopshowtype == 'market' }>超市<{/if}><{if $shopshowtype == 'dingtai' }>订台<{/if}>商家列表</h3></div>
  <div class="toptitR"><a href="#"><i class="search"></i></a></div>
 </div>
</div>
<{/if}>
<{/block}>
<{block name=blockcontent}> 

 <div class="caipinglist float_top" id="ucsss" style="position:fixed;z-index:1000; height:41px;">  

	<section>
		<div class="kouweixz">
			<div class="kwselected kouweiwx"><i class="sort01"></i><span>全部分类</span>&nbsp;<i class="fa fa-angle-down"></i></div>
			
		</div>
		<div class="kouweixzpx">
			<div class="kwselectedpx kouweiwxpx"><i class="sort02"></i><span>默认排序</span>&nbsp;<i class="fa fa-angle-down"></i></div>
			
		</div>
		<div class="kouweixzqsj" style="width:31%; border-right:0px;">
			<div class="kwselectedqsj kouweiwxqsj"><i class="sort03"></i><span>起送价</span>&nbsp;<i class="fa fa-angle-down"></i></div>
			
		</div>
	</section>


    </div>
	<!-- 全部分类 -->
	<div class="kouweidiv" id="wrappercate" style="height:60%;<{if $wxType == 1 }>top:44px;<{/if}>">
					<section>
							<ul id="cuisien" class="lizd" > 
									<li catename="全部分类" id="0" class="xz"><a>全部</a></li>  
									<{foreach from=$caipin item=items}>
									 <li class="typeid_<{$items['id']}>" catename="<{$items['name']}>" id="<{$items['id']}>"><a><{$items['name']}></a></li>
									 <{/foreach}>
						 </ul> 
					</section>
	</div>
	
	
	<!-- 全部排序 -->
	<div class="kouweidivpx">
					<section>
							<ul id="cuisienpx" class="lizd" > 
									<li catename="默认" orderid="0" class=""><a>默认</a></li>  
									<li catename="距离" orderid="1" class=""><a>距离</a></li>  
									<li catename="起送价" orderid="2" class=""><a>起送价</a></li>  
									<li catename="推荐" orderid="3" class=""><a>推荐</a></li>  
									
						 </ul> 
					</section>
	</div>
	
		<!-- 起送价 -->
	<div class="kouweidivqsj">
					<section>
							<ul id="cuisienqsj" class="lizd" > 
									<li catename="不限" qsjid="0" class=""><a>不限起送价</a></li>  
									<li catename="低于5元" qsjid="1" class=""><a>低于5元</a></li>  
									<li catename="5元到10元" qsjid="2" class=""><a>5元到10元</a></li>  
									<li catename="10元以上" qsjid="3" class=""><a>10元以上</a></li> 									
						 </ul> 
					</section>
	</div>
	<script>
		$(".kouweixz").click(function(){
			$(".kouweidiv").toggle();
			$(".kouweidivpx").hide();
			$(".kouweidivqsj").hide();
			$(".kwselected").addClass('kouweiok').siblings().removeClass('kouweiok');
			pulldowncate.refresh();
			
		});
		$(".kouweixzpx").click(function(){
			$(".kouweidivpx").toggle();
			$(".kouweidivqsj").hide();
			$(".kouweidiv").hide();			
			$(".kwselectedpx").addClass('kouweiok').siblings().removeClass('kouweiok');
			
			
		});
			$(".kouweixzqsj").click(function(){
			$(".kouweidivqsj").toggle();
			$(".kouweidivpx").hide();
			$(".kouweidiv").hide();
			$(".kwselectedqsj").addClass('kouweiok').siblings().removeClass('kouweiok');
			
			
		});
	</script>
	

 <div id="wrapper" style="top:35px;<{if $wxType == 2 }>margin-top:40px;<{/if}>bottom:50px;  ">
	<div id="scroller">
		
		
 
		<div id="pullDown" style="display:none;">
			<span class="pullDownIcon"></span><span class="pullDownLabel">下拉刷新...</span>
		</div>
 
		 <div class="nearbyreCon">
		 
		 <{if $mobilemodule == 2}> 
		 
		 <div class=" nearbyreBox "  id="supplierlist" >
		  
		 </div>
		 
		 <{else}>
			
 <div class="homscrbusinBox">
  <ul   id="supplierlist">
   
 
  </ul>
 </div>
		 
		 <{/if}>
		 
		 </div>
		 
	 <center>
	<div id="pullUp" style="border-top:0px; ">
			<div style="width:35%; float:left;text-align:right;"><span class="pullUpIcon" style="  margin-left:60%;"></span></div>
			<div style="width:65%; float:left;text-align:left;"><span class="pullUpLabel">上拉加载更多...</span></div>
		</div>
   </center>
   
   

		
		
		 
   
   
</div>
</div>
<{/block}>